package com.cm.projectx.entity.analysis;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;

@Data
public class RespDto implements Serializable {
    //商品名称
    private String productName;
    //商品规格
    private String productLevel;
    //计量单位
    private String productUnit;
    //价格类型（指标类型）
    private String priceType;
    //价格预警阈值
    private String floatValue;
    //频次
    private String frequency;
    //设计成数组格式，兼容第6张表的展现形式
    //环比值 [{"name":"收购价格", "value":0.05},{"name":"出厂价格", "value":0.06}]
    private List<ValueMapPOJO> circleValues = new ArrayList<>();
    //上期值  [{"name":"收购价格", "value":10},{"name":"出厂价格", "value":10}]
    private List<ValueMapPOJO> lastMetrics = new ArrayList<>();
    //当期值  [{"name":"收购价格", "value":10.5},{"name":"出厂价格", "value":10.6}]
    private List<ValueMapPOJO> nowMetrics = new ArrayList<>();
    //各监测点当期商品价格数据
    // [
    // {"name":"1-32",
    // "value":[{"name":"收购价格", "value":10.5},{"name":"出厂价格", "value":10.6}]
    // }
    // ]
    private HashMap<String, List<ValueMapPOJO>> monitorPriceMapList = new HashMap<>();

    private List<ValueMapPOJO> monitorPrices = new ArrayList<>();

    public void addNowMetrics(String name, String value) {
        this.nowMetrics.add(new ValueMapPOJO(name, value));
    }

    public void addLastMetrics(String name, String value) {
        this.lastMetrics.add(new ValueMapPOJO(name, value));
    }

    public void addCircleValues(String name, String value) {
        this.circleValues.add(new ValueMapPOJO(name, value));
    }
    public void addMonitorPrices(String name, ValueMapPOJO value) {

        if (monitorPriceMapList.containsKey(name)) {
            monitorPriceMapList.get(name).add(value);
        }else {
            ArrayList<ValueMapPOJO> valueMapPOJOS = new ArrayList<>();
            valueMapPOJOS.add(value);
            this.monitorPriceMapList.put(name, valueMapPOJOS);
        }
    }


}
